package com.hanhanxiaochong.zhongxiangchuanmei.presenter.my;

import com.hanhanxiaochong.zhongxiangchuanmei.bean.WalletMoneyBean;
import com.hanhanxiaochong.zhongxiangchuanmei.config.HttpPostService;
import com.hanhanxiaochong.zhongxiangchuanmei.presenter.base.BasePresenter;
import com.hanhanxiaochong.zhongxiangchuanmei.view.iview.IMyWalletView;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;
import com.wzgiceman.rxretrofitlibrary.retrofit_rx.Api.BaseApi;
import com.wzgiceman.rxretrofitlibrary.retrofit_rx.Api.BaseObserver;
import com.wzgiceman.rxretrofitlibrary.retrofit_rx.Api.ResponseBase;
import com.wzgiceman.rxretrofitlibrary.retrofit_rx.http.RetrofitSource;

import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Author : 贾桐
 * E-mail : 653773284@qq.com
 * Time   : 2018/6/9.
 * Desc   :
 */

public class MyWalletPresenter extends BasePresenter<IMyWalletView> {

    public MyWalletPresenter(IMyWalletView iView) {
        super(iView);
    }

    public void getWalletMoney(String token){
        addSubscription(RetrofitSource.createApi(HttpPostService.class)
                .getWalletMoney(token)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseObserver<ResponseBase<WalletMoneyBean>>(iView) {
                    @Override
                    public void onSuccess(ResponseBase<WalletMoneyBean> response) {
                        iView.getWalletMoney(response.getData());
                    }
                }));
    }

    @Override
    public void startPost(RxAppCompatActivity rxAppCompatActivity, BaseApi baseApi) {

    }

    @Override
    public void startPost(RxAppCompatActivity rxAppCompatActivity, BaseApi baseApi, int state) {

    }
}
